﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QLNhaThuoc.MyClass
{
    class SearchDateStrategy:SearchStrategy
    {
        public override string GetSearchExpression()
        {
            string expr;
            if(_visitor != null)
            {
                expr = GetSearchExpression(_visitor);
            }
            else
            {
                DateTime dt = DateTime.Parse(Value);
                string tmp = dt.Month + "/" + dt.Day + "/" + dt.Year;
                expr = "DATEDIFF(d, " + Field + ", '" + tmp + "') = 0";               
            }

            return expr;
        }

        protected override string GetSearchExpression(ISearchVisitor visitor)
        {
            string expr = visitor.Visit(this);
            return expr;
        }
    }
}
